<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE>Base64 - A Public Domain Base64 Encoder/Decoder for Java</TITLE><!-- Generated from XML source. Copyright 2001 Robert Harder. -->
<META http-equiv=Content-Type content=text/html;CHARSET=iso-8859-1>
<META http-equiv=Content-Language content=EN>
<META content="base64, base, 64, java, public domain" name=keywords>
<META content="Base64 - A Public Domain Base64 Encoder/Decoder for Java" 
name=description>
<META content="Base64 - A Public Domain Base64 Encoder/Decoder for Java" 
name=abstract>
<META content="Robert Harder" name=author>
<META content="Robert Harder, 2001" name=copyright>
<META content=Global name=distribution>
<META content="7 days" name=revisit-after>
<META content=FOLLOW,INDEX name=robots><LINK href="./favicon.ico" 
rel="SHORTCUT ICON">
<STYLE type=text/css>BODY {
	MARGIN: 0px
}
.iHarderNet {
	FONT-SIZE: 14pt; COLOR: white; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica; TEXT-ALIGN: center
}
.i_iHarder {
	FONT-WEIGHT: bold; FONT-SIZE: 12pt; FONT-STYLE: italic; FONT-FAMILY: times new roman, courier
}
.MainTitle {
	FONT-WEIGHT: bold; FONT-SIZE: 24pt; MARGIN-BOTTOM: 4pt; COLOR: white; FONT-STYLE: italic; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica; TEXT-ALIGN: center
}
.OpenTS_Home {
	FONT-WEIGHT: bold; FONT-SIZE: 14pt; COLOR: white; FONT-STYLE: italic; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica; TEXT-ALIGN: center
}
.Menu {
	MARGIN-TOP: 10pt; FONT-WEIGHT: bold; FONT-SIZE: 10pt; MARGIN-LEFT: 6pt; TEXT-INDENT: -6pt; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica
}
.SubMenu {
	MARGIN-TOP: -5pt; MARGIN-LEFT: 4pt
}
.MenuItem {
	MARGIN-TOP: 10pt; FONT-WEIGHT: bold; FONT-SIZE: 10pt; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica
}
.Menu A {
	COLOR: #000033
}
.Logo {
	TEXT-ALIGN: center
}
.SubTitle {
	FONT-WEIGHT: bold; FONT-SIZE: 16pt; FONT-STYLE: italic; FONT-FAMILY: Arial, san serif
}
.SectionTitle {
	MARGIN-TOP: 1em; FONT-WEIGHT: bold; FONT-SIZE: larger; MARGIN-LEFT: 1em; MARGIN-RIGHT: 50%; BORDER-BOTTOM: black 4px double; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica
}
.MainSectionTitle {
	MARGIN-TOP: 1em; FONT-WEIGHT: bold; FONT-SIZE: 22pt; BORDER-BOTTOM: black 4px double; FONT-STYLE: italic; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica
}
.SectionBody {
	MARGIN-TOP: 1em
}
.MainSectionBody {
	MARGIN-TOP: 10pt
}
.MainPage {
	MARGIN: 4pt 24pt 4pt 4pt
}
.FAQList_Question {
	FONT-WEIGHT: bold; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica
}
.FAQ_Question {
	FONT-WEIGHT: bold; FONT-FAMILY: arial, geneva, lucida sans unicode, helvetica
}
.FAQ_Answer {
	
}
.TopMenu {
	MARGIN-TOP: 20pt; MARGIN-BOTTOM: 10pt; BORDER-BOTTOM: black 4px; TEXT-ALIGN: center
}
.BottomMenu {
	BORDER-TOP: black 4px double; MARGIN-TOP: 0.1in; MARGIN-BOTTOM: 10pt; BORDER-BOTTOM: black 4px; TEXT-ALIGN: center
}
P {
	MARGIN-TOP: 0.1in; TEXT-INDENT: 1em
}
LI {
	MARGIN-TOP: 0.2in
}
UL {
	MARGIN-TOP: 0.1in; MARGIN-LEFT: 0.25in
}
TT {
	FONT-SIZE: larger
}
A {
	COLOR: #000055
}
A:hover {
	BACKGROUND: lavender; COLOR: black; TEXT-DECORATION: none
}
</STYLE>

<META content="MSHTML 6.00.2800.1106" name=GENERATOR></HEAD>
<BODY bgColor=white>
<TABLE height="100%" cellSpacing=0 cellPadding=0 width="100%" border=0>
  <TBODY>
  <TR bgColor=#000066 height=50>
    <TD width=128 height=50>
      <DIV class=iHarderNet><A href="http://www.iharder.net/"><SPAN 
      class=iHarderNet><SPAN 
    class=i_iHarder>i</SPAN>Harder.net</SPAN></A></DIV></TD>
    <TD width=*>
      <DIV class=MainTitle><TITLE-MEDIUM>Base64</TITLE-MEDIUM> </DIV></TD></TR>
  <TR>
    <TD colSpan=2>
      <DIV style="BORDER-TOP: black 1px double; MARGIN: 0px"></DIV></TD></TR>
  <TR height=*>
    <TD vAlign=top width=128 bgColor=#9090d0>
      <TABLE height="100%" cellSpacing=0 cellPadding=2 width="100%" border=0>
        <TBODY>
        <TR height=1>
          <TD vAlign=center align=middle width=120 bgColor=white height=1>
            <DIV class=SubTitle>Base64 </DIV></TD></TR>
        <TR>
          <TD style="BORDER-RIGHT: black 1px solid; BORDER-TOP: black 1px solid" 
          vAlign=top height=*>
            <DIV class=Menu><A title="" 
            href="http://prdownloads.sourceforge.net/iharder/base64-1.3.6.zip">Download 
            now!</A> 
            <DIV class=SubMenu></DIV></DIV>
            <DIV class=Menu><A title="" 
            href="file:///J:/opensource/workspace/BIE6.0.4/commons-tools/net/iharder/api/index.html">Base64 
            API</A> 
            <DIV class=SubMenu></DIV></DIV>
            <P>
            <HR align=center>

            <P></P>
            <DIV style="TEXT-ALIGN: center" align=center><A 
            href="http://sourceforge.net/"><IMG height=31 alt="SourceForge Logo" 
            src="Base64 - A Public Domain Base64 Encoder-Decoder for Java_files/sflogo.png" 
            width=88 border=0> </A></DIV>
            <P>
            <DIV style="TEXT-ALIGN: center" align=center><A 
            href="file:///J:/gotmoney.php"><IMG height=32 alt="got money?" 
            src="Base64 - A Public Domain Base64 Encoder-Decoder for Java_files/gotmoney.gif" 
            width=88 border=0> </A></DIV></TD></TR></TBODY></TABLE></TD>
    <TD vAlign=top width=* bgColor=white height=*>
      <DIV class=MainPage>
      <DIV class=MainSectionTitle>Summary</DIV>
      <DIV class=MainSectionBody>
      <P>This is a <STRONG>Public Domain</STRONG> Java class providing 
      <STRONG>very fast</STRONG> Base64 encoding and decoding in the form of 
      convenience methods and input/output streams. </P>
      <P style="FONT-WEIGHT: bold; FONT-SIZE: larger; TEXT-ALIGN: center"><A 
      href="http://prdownloads.sourceforge.net/iharder/base64-1.3.6.zip">Download 
      Now! base64.zip (34k)</A> </P>
      <P>You can have SourceForge automatically notify you when this Base64 code 
      is updated (I highly recommend you do this). <A 
      href="http://sourceforge.net/project/filemodule_monitor.php?filemodule_id=30229">Click 
      here.</A> </P>
      <P>There are other Base64 utilities on the Internet, some part of 
      proprietary packages, some with various open source licenses. One such 
      package is a good Base64 tool available with other good Java tools under 
      the GNU Public License at <A 
      href="http://kevinkelley.mystarband.net/java/goodies.html">http://kevinkelley.mystarband.net/java/goodies.html</A>. 
      In any event, I hope with one or more of these Base64 tools, you won't 
      have to write your own like I did. </P>
      <P><STRONG>Bug fixes:</STRONG> 
      <UL>
        <LI>v1.3.6 - Fixed OutputStream.flush() so that 'position' is reset. 
        <LI>v1.3.5 - Added flag to turn on and off line breaks. Fixed bug in 
        input stream where last buffer being read, if not completely full, was 
        not returned. 
        <LI>v1.3.4 - Fixed when <EM>Improperly padded base64 stream</EM> 
        exception was incorrectly thrown. 
        <LI>A bug has been fixed that kept I/O streams from working at all, 
        really. 
        <LI>A bug has been fixed affecting you if you use the Base64.InputStream 
        to encode data. 
        <LI>A bug has been fixed where if you specified an offset when encoding 
        an array of bytes, the offset was ignored. </LI></UL>
      <P></P></DIV>
      <DIV class=MainSectionTitle>Example</DIV>
      <DIV class=MainSectionBody>
      <P>The easiest way to convert some data is with the convenience methods: 
      </P><CODE><PRE>String result1 = <STRONG>Base64.encodeString</STRONG>( "Why encode ASCII text?" );
String result2 = <STRONG>Base64.encodeObject</STRONG>( mySerializableObject );
String result3 = <STRONG>Base64.encodeBytes</STRONG>( new byte[]{ 3, 34, 116, 9 } );
</PRE></CODE>
      <P>Or you can use the very efficient streams: </P><CODE><PRE>OutputStream out = <STRONG>new Base64.OutputStream</STRONG>( 
                    new FileOutputStream( "out.txt" ) );
// Go on about your outputting...
// ...

InputStream in = <STRONG>new Base64.InputStream</STRONG>( 
                  new FileInputStream( "in.txt" ) );
// Go on about your inputting...
// ...
</PRE></CODE>
      <P>There are defaults (OutputStream encodes, InputStream decodes), but you 
      can easily override that: </P><CODE><PRE>OutputStream out = new Base64.OutputStream( 
                    new FileOutputStream( "out.txt" ), <STRONG>Base64.DECODE</STRONG> );
// Go on about your outputting...
// ...
</PRE></CODE></DIV></DIV></TD></TR>
  <TR>
    <TD style="BORDER-RIGHT: black 1px solid; HEIGHT: 1em" 
    bgColor=#9090d0>&nbsp;</TD>
    <TD>
      <DIV class=BottomMenu><SPAN class=Menu><A title="" 
      href="http://prdownloads.sourceforge.net/iharder/base64-1.3.6.zip">Download 
      now!</A> | </SPAN><SPAN class=Menu><A title="" 
      href="file:///J:/opensource/workspace/BIE6.0.4/commons-tools/net/iharder/api/index.html">Base64 
      API</A> </SPAN></DIV></TD></TR></TBODY></TABLE></BODY></HTML>
